package com.qf.controller;

import com.qf.pojo.reqVo.MessageReq;
import com.qf.pojo.respVo.BaseResp;
import com.qf.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RequestMapping("/message")
@RestController
public class MessageController {

    @Autowired
    MessageService messageService;

    /**
     * 获取到所有的在线用户
     * @param request
     * @return
     */
    @RequestMapping("/findTalkUser")
    public BaseResp findTalkUser(HttpServletRequest request){
        return messageService.findTalkUser(request);
    }
    /**
     * 获取跟聊天人的对话列表
     * @param request
     * @return
     */
    @RequestMapping("/findTalkListByToken")
    public BaseResp findTalkListByToken(HttpServletRequest request,@RequestBody Map map){
        return messageService.findTalkListByToken(request,map);
    }

    /**
     * 进行消息的发送
     * @param messageReq
     * @param request
     * @return
     */
    @RequestMapping("/sendMsg")
    public BaseResp sendMsg(@RequestBody  MessageReq messageReq, HttpServletRequest request){
        return messageService.sendMsg(messageReq,request);
    }
}
